<template>
  <div class="page">
    <div class="tab-box vux-1px-b">
      <span :class="{'active':tabType==1}" @click="tabType=1">车牌号码</span>
      <span :class="{'active':tabType==2}" @click="tabType=2">固定二维码</span>
    </div>
    <!-- 固定二维码tab-box -->
    <div class="main-content" v-if="tabType==2">
      <div class="top-box">
        <div class="num-tip">今日发放:5张</div>
        <div class="search-box">
          <img src="../../assets/img/ic/search@2x.png" alt="">
          <input type="text" placeholder="请输入分组名称">
          <span>搜索</span>
        </div>
      </div>
      <!-- 生效中 -->
      <div class="record-item">
        <div class="item-title">
          <span class="group-name">分组名称A</span>
          <img src="../../assets/img/takeeffect_record@2x.png" alt="">
          <span class="coupon-name">麦当劳优惠券</span>
        </div>
        <div class="item-time">
          <span class="date-time">发放时间:&nbsp;2018-09-20 11:25:30</span>
          <div class="more-box" v-show="isOpen==1" @click="isOpen=2">
            <span>更多</span>
            <img src="../../assets/img/ic/down_calendar@2x.png" alt="">
          </div>
          <div class="more-box" v-show="isOpen==2" @click="isOpen=1">
            <span>收起</span>
            <img src="../../assets/img/ic/up_calendar@2x.png" alt="">
          </div>
        </div>
        <div class="more-detail vux-1px-t" v-show="isOpen==2">
          <span>已发放数量:&nbsp;2</span>
          <span>最大发放量:&nbsp;50</span>
          <span>有效期至:&nbsp;&nbsp;&nbsp;&nbsp;2018-12-23 11:23:56</span>
        </div>
      </div>
      <!-- 已删除 -->
      <div class="record-item">
        <div class="item-title">
          <span class="group-name">分组名称B</span>
          <img src="../../assets/img/deleted_record@2x.png" alt="">
          <span class="coupon-name">麦当劳优惠券</span>
        </div>
        <div class="item-time">
          <span class="date-time">发放时间:&nbsp;2018-09-20 11:25:30</span>
          <div class="more-box" v-show="isOpen==1" @click="isOpen=2">
            <span>更多</span>
            <img src="../../assets/img/ic/down_calendar@2x.png" alt="">
          </div>
          <div class="more-box" v-show="isOpen==2" @click="isOpen=1">
            <span>收起</span>
            <img src="../../assets/img/ic/up_calendar@2x.png" alt="">
          </div>
        </div>
        <div class="more-detail vux-1px-t" v-show="isOpen==2">
          <span>已发放数量:&nbsp;2</span>
          <span>最大发放量:&nbsp;50</span>
          <span>有效期至:&nbsp;&nbsp;&nbsp;&nbsp;2018-12-23 11:23:56</span>
        </div>
      </div>
      <!-- 已过期 -->
      <div class="record-item expired">
        <div class="item-title">
          <span class="group-name">分组名称C</span>
          <img src="../../assets/img/overdue_record@2x.png" alt="">
          <span class="coupon-name">麦当劳优惠券</span>
        </div>
        <div class="item-time">
          <span class="date-time">发放时间:&nbsp;2018-09-20 11:25:30</span>
          <div class="more-box" v-show="isOpen==1" @click="isOpen=2">
            <span>更多</span>
            <img src="../../assets/img/ic/down_calendar@2x.png" alt="">
          </div>
          <div class="more-box" v-show="isOpen==2" @click="isOpen=1">
            <span>收起</span>
            <img src="../../assets/img/ic/up_calendar@2x.png" alt="">
          </div>
        </div>
        <div class="more-detail vux-1px-t" v-show="isOpen==2">
          <span>已发放数量:&nbsp;2</span>
          <span>最大发放量:&nbsp;50</span>
          <span>有效期至:&nbsp;&nbsp;&nbsp;&nbsp;2018-12-23 11:23:56</span>
        </div>
      </div>
    </div>
    <!-- 车牌号码tab-box -->
    <div class="main-content" v-if="tabType==1">
      <div class="top-box">
        <div class="num-tip">今日发放:5张</div>
        <div class="search-box">
          <img src="../../assets/img/ic/search@2x.png" alt="">
          <input v-model="keyword" type="text" placeholder="请输入3-6位车牌号">
          <img class="close-btn" src="../../assets/img/ic/cleanup@2x.png" alt="" v-show="isShowCleanKeywordBtn" @click="cleanKeyword">
          <span>搜索</span>
        </div>
      </div>
      <!-- 未使用 -->
      <div class="record-item">
        <div class="item-title">
          <span class="group-name">分组名称A</span>
          <img src="../../assets/img/sing_notused_record@2x.png" alt="">
          <span class="coupon-name">麦当劳优惠券</span>
        </div>
        <div class="item-time">
          <span class="date-time">发放时间:&nbsp;2018-09-20 11:25:30</span>
          <div class="more-box" v-show="isOpen==1" @click="isOpen=2">
            <span>更多</span>
            <img src="../../assets/img/ic/down_calendar@2x.png" alt="">
          </div>
          <div class="more-box" v-show="isOpen==2" @click="isOpen=1">
            <span>收起</span>
            <img src="../../assets/img/ic/up_calendar@2x.png" alt="">
          </div>
        </div>
        <div class="more-detail vux-1px-t" v-show="isOpen==2">
          <span>有效期至:&nbsp;2018-12-23 11:23:56</span>
        </div>
      </div>
      <!-- 已使用 -->
      <div class="record-item">
        <div class="item-title">
          <span class="group-name">分组名称B</span>
          <img src="../../assets/img/used_record@2x.png" alt="">
          <span class="coupon-name">麦当劳优惠券</span>
        </div>
        <div class="item-time">
          <span class="date-time">发放时间:&nbsp;2018-09-20 11:25:30</span>
          <div class="more-box" v-show="isOpen==1" @click="isOpen=2">
            <span>更多</span>
            <img src="../../assets/img/ic/down_calendar@2x.png" alt="">
          </div>
          <div class="more-box" v-show="isOpen==2" @click="isOpen=1">
            <span>收起</span>
            <img src="../../assets/img/ic/up_calendar@2x.png" alt="">
          </div>
        </div>
        <div class="more-detail vux-1px-t" v-show="isOpen==2">
          <span>有效期至:&nbsp;2018-12-23 11:23:56</span>
        </div>
      </div>
      <!-- 已过期 -->
      <div class="record-item expired">
        <div class="item-title">
          <span class="group-name">分组名称C</span>
          <img src="../../assets/img/overdue_record@2x.png" alt="">
          <span class="coupon-name">麦当劳优惠券</span>
        </div>
        <div class="item-time">
          <span class="date-time">发放时间:&nbsp;2018-09-20 11:25:30</span>
          <div class="more-box" v-show="isOpen==1" @click="isOpen=2">
            <span>更多</span>
            <img src="../../assets/img/ic/down_calendar@2x.png" alt="">
          </div>
          <div class="more-box" v-show="isOpen==2" @click="isOpen=1">
            <span>收起</span>
            <img src="../../assets/img/ic/up_calendar@2x.png" alt="">
          </div>
        </div>
        <div class="more-detail vux-1px-t" v-show="isOpen==2">
          <span>有效期至:&nbsp;2018-12-23 11:23:56</span>
        </div>
      </div>
    </div> 
  </div>
</template>

<script>
  export default {
    data(){
      return {
        title: '发放记录',
        tabType: 1, //tab类型(1:车牌号码 2:固定二维码)
        isOpen: 1, //是否展示信息(1:不展开;2:展开)
        keyword: '' //关键字
      }
    },
    created() {
      this.$store.commit("setTitle", this.title);
      this.$store.commit("setShowCloseBtn", false);
    },
    computed: {
      isShowCleanKeywordBtn(){
        if(this.keyword==''){
          return false
        }
        return true
      },
    },
    methods: {
      cleanKeyword(){
        this.keyword=''
      }
    }
  }
</script>

<style lang="less" scoped>
.tab-box{
  height: 100px;
  // border: 1px solid red;
  display: flex;
  padding: 0px 30px;
  justify-content: space-between;
  background: #ffffff;
  span{
    text-align: center;
    flex-grow: 1;
    line-height: 100px;
    font-size: 28px;
    &.active{
      color: #1875ed;
      border-bottom: 5px solid #1875ed;
    }
  }
}
.main-content{
  .top-box{
    background: #ffffff;
    padding: 20px 25px 20px 25px;
    .num-tip{
      font-size: 24px;
      color: #a6a6a6;
    }
    .search-box{
      display: flex;
      justify-content: space-between;
      height: 60px;
      line-height: 60px;
      margin-top: 10px;
      img{
        width: 60px;
        height: 60px;
        margin-right: 10px;
        &.close-btn{
          width: 48px;
          height: 48px;
          margin-right: 30px;
          margin-top: 5px;
        }
      }
      input{
        font-size: 34px;
        flex:1;
      }
      input::input-placeholder{color: #bbbbbb!important;} 
      span{
        font-size: 34px;
        color: #1875ed;
      }
    }
  }
  
  .record-item{
    margin-top: 20px;
    background: #ffffff;
    padding: 20px 20px 0 20px;
    .item-title{
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      .group-name{
        font-size: 36px;
        letter-spacing: 1.5px;
        font-weight: bold;
      }
      img{
        width: 82px;
        height: 34px;
        margin-left: 20px;
        margin-bottom: 5px;
      }
      .coupon-name{
        font-size: 30px;
        flex: 1;
        text-align: right;
        letter-spacing: 1.2px;
      }
    }
    .item-time{
      height: 80px;
      line-height: 80px;
      position: relative;
      .date-time{
        display: block;
        font-size: 24px;
        color: #9f9f9f;
      }
      .more-box{
        position: absolute;
        top: 0;
        right: 0;
        display: flex;
        span{
          font-size: 24px;
          height: 80px;
          line-height: 80px;
          color: #b8b8b8;
        }
        img{
          width: 60px;
          height: 60px;
          margin-top: 10px;
        }
      }
    }
    &.expired{
      span{
        color: #cecece;
      }
      .item-time{
        span{
          color: #cecece;
        }
      }
    }
  }
  .more-detail{
    padding-top: 30px;
    padding-bottom: 20px;
    display: flex;
    flex-direction: column;
    span{
      color: #9f9f9f;
      font-size: 26px;
      letter-spacing: 2px;
      height: 50px;
      line-height: 50px;
    }
  }
}
</style>
